﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace ChurchFI
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.AppendHeader("Cache-Control", "no-cache");

            if (Request["login"] != null && Request["login"].ToString().Equals("1"))
            {
                FormsAuthentication.SetAuthCookie("id", true);
               
                Response.Redirect("./");
            }
            
            if (Request["logout"] != null && Request["logout"].ToString().Equals("1"))
            {
                FormsAuthentication.SignOut(); //인증쿠키 삭제
            }

            if (User.Identity.IsAuthenticated)
            {
                Response.Redirect("./");
            }

        }
    }
}